<template>
  <div class="topRightBlock">
    <div class="menu-list">
      <div
        v-for="(item, index) in menuList"
        :key="index"
        class="menu-label"
        :class="selectMenu === item.id ? 'colorSel' : 'colorWhite'"
        @click="selectPeriodClick(item.id)"
      >
        {{ item.value }}
      </div>
    </div>
    <div class="info-view">
      <el-badge is-dot class="item">
        <el-dropdown @command="handleCommand">
          <el-avatar shape="square" :size="size" :src="squareUrl" class="cur-porinter"></el-avatar>
          <el-dropdown-menu slot="dropdown">
            <el-dropdown-item command="logout">退出</el-dropdown-item>
          </el-dropdown-menu>
        </el-dropdown>
      </el-badge>
      <div class="info-title">高新分局</div>
    </div>
  </div>
</template>

<script>
export default {
  components: {},
  props: {},
  data() {
    return {
      menuList: [
        { id: 1, value: "全景数据" },
        { id: 2, value: "统计查询" },
        { id: 5, value: "设备管理" },
        { id: 4, value: "住户分析" },
        { id: 3, value: "标签管理" }
      ],
      selectMenu: 1,
      size: "small",
      squareUrl: require("@/assets/img/login-head.png")
    }
  },
  mounted() {},
  watch: {},
  methods: {
    selectPeriodClick(val) {
      this.selectMenu = val
      if (val === 2) {
        this.$router.push({ path: "/statisticsQuery/statisticsQueryPage" })
      } else if (val === 3) {
        this.$router.push({ path: "/labelManagement/labelPage" })
      } else if (val === 4) {
        this.$router.push({ path: "/residentManage/residentAnalyse" })
      } else if (val === 5) {
        this.$router.push({ path: "/deviceManage/devicePage" })
      }
    },
    handleCommand(command) {
      console.log(command)
      if (command === "logout") {
        this.$router.push({ path: "/login" })
      }
    }
  }
}
</script>

<style scoped lang="scss">
$marginTop: 15px;
.topRightBlock {
  width: 100%;
  height: 100%;
  color: #cdcfd0;
  // background: rgba(3, 10, 14, 0.9);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 3;
  .menu-list {
    margin-top: $marginTop;
    display: flex;
    align-items: center;
    font-size: 18px;
    font-family: "SourceHanSans";
    .menu-label {
      margin-left: 55px;
      cursor: pointer;
    }
  }
  .info-view {
    margin-top: $marginTop;
    display: flex;
    align-items: center;
    .info-title {
      margin-left: 20px;
      font-size: 18px;
      font-family: "SourceHanSans";
    }
    .cur-porinter {
      cursor: pointer;
    }
  }
}
.colorSel {
  color: #6ad6f1;
  font-weight: bold;
}
.colorWhite {
  color: rgba(255, 255, 255, 0.8);
}

::v-deep {
  .el-badge__content,
  .el-progress {
    background-color: #4caf50;
    border: 2px solid #1f2935;
  }
  .el-badge__content.is-dot {
    height: 10px;
    width: 10px;
  }
  .el-avatar {
    background: #385065;
  }
}
</style>
<style lang="scss">
/* 整体背景色和圆角 */
.el-dropdown-menu {
  padding-top: 10px;
  background-color: #0a1a34 !important ;
  border: 1px solid #f3f7f6 !important ;
  border-radius: 5px;
  color: #f3f7f6 !important;
}
/* 下拉框定位 */
.el-popper {
  position: absolute !important ;
  // top: 56px !important;
}
.el-popper[x-placement^="bottom"] {
  margin-top: 10px;
  margin-bottom: 10px;
  padding: 0px;
}
.el-dropdown-menu__item:not(:last-of-type) {
  border-bottom: 1px solid #00487f;
}
/* 消除小三角 */
.el-popper[x-placement^="bottom"] .popper__arrow {
  border: none;
}
.el-popper[x-placement^="bottom"] .popper__arrow::after {
  border: none;
}
</style>
